import { request } from '@/utils'

export default {
  // 获取居委下拉列表
  getJuweiList: (params = {}) =>
    request.get('/sys/peoplebaseinfo/select/neighborhood_committee', {
      params,
    }),

  // 获取人员列表
  getUserList: (params = {}) => {
    const queryParams = { ...params};

    ['receivedSubsidyList', 'tagList'].forEach(key => {
      if (queryParams[key] && queryParams[key].length) {
        queryParams[key] = queryParams[key].join(',');
      }
    });
  
    return request.get('/sys/peoplebaseinfo/page', { params: queryParams });
  },

  // 获取人员详情
  getUserDetail: (params = {}) =>
    request.get('/sys/peoplebaseinfo/detail', { params }),

  // 修改人员详情
  updateUserDetail: (params = {}) =>
    request.post('/sys/peoplebaseinfo/save_or_update', params),

  // 获取历史数据
  getUserDetailHistory: (params = {}) =>
    request.get('/data_log/historical_data', { params }),

  // 获取日志信息
  getLogList: (params = {}) => request.get('/data_log/page', { params }),

  
  // 获取街道列表
  getStreetList: (params = {}) =>
    request.get('/sys/peoplebaseinfo/select/street', { params }),
}
